package com.dc.project.entity.po;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.own.component.common.base.entity.po.BasePo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Map;

/**
 * TemplateDetailAttachmentField
 *
 * @author chenxueli
 * @date 2025-03-19 13:23:08
 */
@Schema(title = "模板详情附件字段" + ConstantBeanSuffix.PO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "t_template_detail_attachment_field")
public class TemplateDetailAttachmentField extends BasePo implements Serializable {

    /**
     * 上级字段id
     */
    private Long fkParentId;

    /**
     * 模板详情附件id
     */
    private Long fkDetailAttachmentId;

    /**
     * 字段名称
     */
    private String name;

    /**
     * 字段描述
     */
    private String description;

    /**
     * 默认值
     */
    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private String defaultValue;

    public static final Map<Integer, String> FIELD_TYPE_MAP = Map.of(
            Type.TEXT, "文本类型",
            Type.INTEGER, "整数类型",
            Type.DECIMAL, "小数类型",
            Type.NUMBER, "数字类型",
            Type.TABLE_ROW, "表格类型",
            Type.TABLE_COLUMN, "表格类型",
            Type.LIST, "列表类型",
            Type.IMAGE, "图片类型",
            Type.BLOCK_PAIR, "区块对类型"
    );
    /**
     * 字段类型 1=文本 2=整数 3=小数 4=数字 5=表格-行循环 6=表格-列循环 7=列表 8=图片 9=区块对
     */
    private Integer type;

    public interface Type {
        /**
         * 文本
         */
        int TEXT = 1;
        /**
         * 整数
         */
        int INTEGER = 2;
        /**
         * 小数
         */
        int DECIMAL = 3;
        /**
         * 数字
         */
        int NUMBER = 4;
        /**
         * 表格-行循环
         */
        int TABLE_ROW = 5;
        /**
         * 表格-列循环
         */
        int TABLE_COLUMN = 6;
        /**
         * 列表
         */
        int LIST = 7;
        /**
         * 图片
         */
        int IMAGE = 8;
        /**
         * 区块对
         */
        int BLOCK_PAIR = 9;
    }

}
